resource_files = \
bloatpad.gresources.xml \
- menus.ui
+ gtk/menus.ui
bloatpad-gresources.c: $(resource_files)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
{
BloatPad *bloatpad = (BloatPad*) application;
GtkApplication *app = GTK_APPLICATION (application);
- GtkBuilder *builder;
GMenu *menu;
GMenuItem *item;
GIcon *icon;
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
- builder = gtk_builder_new_from_resource ("/org/gtk/bloatpad/menus.ui");
- gtk_application_set_app_menu (app, G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
- gtk_application_set_menubar (app, G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
for (i = 0; i < G_N_ELEMENTS (accels); i++)
gtk_application_set_accels_for_action (app, accels[i].action_and_target, accels[i].accelerators);
- menu = G_MENU (gtk_builder_get_object (builder, "icon-menu"));
+ menu = gtk_application_get_menu_by_id (GTK_APPLICATION (application), "icon-menu");
file = g_file_new_for_path (SRCDIR "/../gtk/stock-icons/16/help-about.png");
icon = g_file_icon_new (file);
dump_accels (GTK_APPLICATION (application));
//gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
- bloatpad->time = G_MENU (gtk_builder_get_object (builder, "time-menu"));
- g_object_unref (builder);
+ bloatpad->time = gtk_application_get_menu_by_id (GTK_APPLICATION (application), "time-menu");
}
static void
<gresources>
<gresource prefix="/org/gtk/bloatpad">
- <file preprocess="xml-stripblanks">menus.ui</file>
+ <file preprocess="xml-stripblanks">gtk/menus.ui</file>
</gresource>
</gresources>
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+
+<interface>
+ <menu id='app-menu'>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>_New Window</attribute>
+ <attribute name='action'>app.new</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>_About Bloatpad</attribute>
+ <attribute name='action'>app.about</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>_Quit</attribute>
+ <attribute name='action'>app.quit</attribute>
+ </item>
+ </section>
+ </menu>
+ <menu id='menubar'>
+ <submenu>
+ <attribute name='label' translatable='yes'>_Edit</attribute>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>_Copy</attribute>
+ <attribute name='action'>win.copy</attribute>
+ </item>
+ <item>
+ <attribute name='label' translatable='yes'>_Paste</attribute>
+ <attribute name='action'>win.paste</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <!-- action should never be missing (so always shown) -->
+ <attribute name='label'>Clear (always shown)</attribute>
+ <attribute name='action'>win.clear</attribute>
+ <attribute name='hidden-when'>action-missing</attribute>
+ </item>
+ <item>
+ <attribute name='label'>Clear (hidden when no text)</attribute>
+ <attribute name='hidden-when'>action-disabled</attribute>
+ <attribute name='action'>win.clear</attribute>
+ </item>
+ <item>
+ <attribute name='label'>Spell check (does nothing, hides)</attribute>
+ <attribute name='hidden-when'>action-missing</attribute>
+ <attribute name='action'>win.spell-check</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>Accelerators...</attribute>
+ <attribute name='action'>app.edit-accels</attribute>
+ </item>
+ </section>
+ </submenu>
+ <submenu>
+ <attribute name='label' translatable='yes'>_View</attribute>
+ <section>
+ <item>
+ <attribute name='label' translatable='yes'>_Fullscreen</attribute>
+ <attribute name='action'>win.fullscreen</attribute>
+ </item>
+ <item>
+ <attribute name='label' translatable='yes'>_Look Busy</attribute>
+ <attribute name='action'>win.busy</attribute>
+ </item>
+ </section>
+ </submenu>
+ <submenu id='icon-menu'>
+ <attribute name='label' translatable='yes'>_Icons</attribute>
+ </submenu>
+ <submenu id='time-menu'>
+ <attribute name='label' translatable='yes'>Time</attribute>
+ <attribute name='submenu-action'>app.time-active</attribute>
+ </submenu>
+ </menu>
+</interface>
+++ /dev/null
-<?xml version='1.0' encoding='UTF-8'?>
-
-<interface>
- <menu id='app-menu'>
- <section>
- <item>
- <attribute name='label' translatable='yes'>_New Window</attribute>
- <attribute name='action'>app.new</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name='label' translatable='yes'>_About Bloatpad</attribute>
- <attribute name='action'>app.about</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name='label' translatable='yes'>_Quit</attribute>
- <attribute name='action'>app.quit</attribute>
- </item>
- </section>
- </menu>
- <menu id='menubar'>
- <submenu>
- <attribute name='label' translatable='yes'>_Edit</attribute>
- <section>
- <item>
- <attribute name='label' translatable='yes'>_Copy</attribute>
- <attribute name='action'>win.copy</attribute>
- </item>
- <item>
- <attribute name='label' translatable='yes'>_Paste</attribute>
- <attribute name='action'>win.paste</attribute>
- </item>
- </section>
- <section>
- <item>
- <!-- action should never be missing (so always shown) -->
- <attribute name='label'>Clear (always shown)</attribute>
- <attribute name='action'>win.clear</attribute>
- <attribute name='hidden-when'>action-missing</attribute>
- </item>
- <item>
- <attribute name='label'>Clear (hidden when no text)</attribute>
- <attribute name='hidden-when'>action-disabled</attribute>
- <attribute name='action'>win.clear</attribute>
- </item>
- <item>
- <attribute name='label'>Spell check (does nothing, hides)</attribute>
- <attribute name='hidden-when'>action-missing</attribute>
- <attribute name='action'>win.spell-check</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name='label' translatable='yes'>Accelerators...</attribute>
- <attribute name='action'>app.edit-accels</attribute>
- </item>
- </section>
- </submenu>
- <submenu>
- <attribute name='label' translatable='yes'>_View</attribute>
- <section>
- <item>
- <attribute name='label' translatable='yes'>_Fullscreen</attribute>
- <attribute name='action'>win.fullscreen</attribute>
- </item>
- <item>
- <attribute name='label' translatable='yes'>_Look Busy</attribute>
- <attribute name='action'>win.busy</attribute>
- </item>
- </section>
- </submenu>
- <submenu id='icon-menu'>
- <attribute name='label' translatable='yes'>_Icons</attribute>
- </submenu>
- <submenu id='time-menu'>
- <attribute name='label' translatable='yes'>Time</attribute>
- <attribute name='submenu-action'>app.time-active</attribute>
- </submenu>
- </menu>
-</interface>